//数据序列化类统一管理
import 'package:framelib/net/base_entity_factory.dart';

import '../../module_contact/model/interest_chat_channel_entity.dart';
import 'gift_entity.dart';

class ChatEntityFactory with BaseEntityFactory{
  static final ChatEntityFactory _singleton = ChatEntityFactory._internal();

  static ChatEntityFactory get instance => ChatEntityFactory();


  factory ChatEntityFactory() {
    return _singleton;
  }

  ChatEntityFactory._internal(){
    //做一些操作
  }

   T generateOBJ<T>(json) {
    if(json==null)return null;
    if (1 == 0) {
      return null;
    } else if (T.toString() == "String") {
      return json as T;
    }
    else if (T.toString() == "GiftEntity") {
      return GiftEntity.fromJson(json) as T;
    }

    else {
      return null;
    }
  }
}
